<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>接口测试页面</title>
</head>
<script type='text/javascript' src='js/prototype.js'></script>
<script type='text/javascript' src='js/sha1.js'></script>
<script type='text/javascript'>
function login() {
	var userId = document.getElementById("userId").value;
	var userPwd = hex_sha1(document.getElementById("userPwd").value);
	var params = "userId=" + userId + "&userPwd=" + userPwd;
	alert(params);
	new Ajax.Request("json/login", {
		method : "post",
		parameters : params,
		onComplete : function(request) {
			alert(1);
			var res = request.responseText.evalJSON();
			if (res["result"]["flag"] == "true") {
				alert("已经登陆成功");
			} else
				alert("用户名或密码错误！");
		},
		asynchronous : true
	});
}
</script>
<body>
	<form method="post">
		<input type="text" id="userId" onclick="clear()" value="用户名"
			name="userId" /> <input type="password" id="userPwd"
			name="userPwd" /> <input type="button" value="login"
			onclick="login()" />
	</form>
</body>
</html>